/**
 * Copyright 2025 Beijing Volcano Engine Technology Co., Ltd. All Rights Reserved.
 * SPDX-license-identifier: BSD-3-Clause
 */


 import utils from '@/utils/utils';
import styles from './index.module.less';
 import './index.module.less';
 import Success from '@/assets/AiImgs/Success.png'
 import { Link,useSearchParams,useNavigate } from 'react-router-dom';
import {useEffect, useState} from "react";
import {getPracticeTrainingInfo} from "@/api/train";
 export default function () {
    const [searchParams, setSearchParams] = useSearchParams()
    const navigate = useNavigate();
    const prcid = searchParams.get('prcid')
    const goReportPage=()=>{
        navigate(`/aiPracticeDetail?prcid=${prcid}`,{ replace: false })
        localStorage.removeItem('training_id')
    }
    const [practiceTraining,setPracticeTrainingInfo]=useState<any>([])
     useEffect(()=>{
         getPracticeTrainingInfo(prcid).then(res=>{
             if(res.code===2000){
                 setPracticeTrainingInfo(res?.data)
             }
         })
     },[])
     return (
        <div className="flex min-h-full flex-col justify-center items-center bg-white h-screen px-6 py-12 lg:px-8">
            <div className="sm:mx-auto sm:w-full sm:max-w-sm">
                <img className="mx-auto  w-[180px]" src={Success}/>
                <p className="mt-5  text-center text-base/6  tracking-tight text-[#222222]">恭喜您完成了</p>
                <p className="text-center text-base/6  tracking-tight text-[#222222]">“{practiceTraining.title}”的训练</p>
                <button type="submit" onClick={goReportPage} className="flex m-auto mt-5  w-4/5 justify-center rounded-full bg-[#FFBC0D] px-3 py-3 text-lg/6 font-semibold text-black shadow-xs  focus-visible:outline-2 focus-visible:outline-offset-2">查看报告</button>
                <Link to="/aiPracticeStart"><button type="submit" className="flex m-auto mt-6  w-4/5 justify-center rounded-full border-[#666666] border-[0.5px] border-solid px-3 py-3 text-lg/6  text-black shadow-xs  focus-visible:outline-2 focus-visible:outline-offset-2">再次练习</button></Link>
            </div>

           
         </div>
     );
 }
